package com.siyu.tickets.entity.base;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.siyu.tickets.entity.Order;
import com.siyu.tickets.entity.Ticket;

public abstract class BaseOrder implements Serializable {

	private static final long serialVersionUID = 2708793543132117741L;

	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private Integer id;

	// fields
	private Integer quantity;
	private BigDecimal price;
	private BigDecimal money;

	private String type;

	private String consumerName;
	private String consumerIdcard;
	private String consumerMobile;
	private String salesman;

	private Boolean isPay;
	private Boolean allowRefund;
	private Boolean valid;

	private Date createTime;
	private Date payTime;

	private String remark;

	// many to one
	private com.siyu.tickets.entity.Partner partner;
	private com.siyu.tickets.entity.Product product;

	// one to many
	private Set<Ticket> tickets = new HashSet<Ticket>();

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public BigDecimal getMoney() {
		return money;
	}

	public void setMoney(BigDecimal money) {
		this.money = money;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getConsumerName() {
		return consumerName;
	}

	public void setConsumerName(String consumerName) {
		this.consumerName = consumerName;
	}

	public String getConsumerIdcard() {
		return consumerIdcard;
	}

	public void setConsumerIdcard(String consumerIdcard) {
		this.consumerIdcard = consumerIdcard;
	}

	public String getConsumerMobile() {
		return consumerMobile;
	}

	public void setConsumerMobile(String consumerMobile) {
		this.consumerMobile = consumerMobile;
	}

	public String getSalesman() {
		return salesman;
	}

	public void setSalesman(String salesman) {
		this.salesman = salesman;
	}

	public Boolean getIsPay() {
		return isPay;
	}

	public void setIsPay(Boolean isPay) {
		this.isPay = isPay;
	}

	public Boolean getAllowRefund() {
		return allowRefund;
	}

	public void setAllowRefund(Boolean allowRefund) {
		this.allowRefund = allowRefund;
	}

	public Boolean getValid() {
		return valid;
	}

	public void setValid(Boolean valid) {
		this.valid = valid;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getPayTime() {
		return payTime;
	}

	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public com.siyu.tickets.entity.Partner getPartner() {
		return partner;
	}

	public void setPartner(com.siyu.tickets.entity.Partner partner) {
		this.partner = partner;
	}

	public com.siyu.tickets.entity.Product getProduct() {
		return product;
	}

	public void setProduct(com.siyu.tickets.entity.Product product) {
		this.product = product;
	}

	public Set<Ticket> getTickets() {
		return tickets;
	}

	public void setTickets(Set<Ticket> tickets) {
		this.tickets = tickets;
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof Order))
			return false;
		else {
			Order user = (Order) obj;
			if (null == this.getId() || null == user.getId())
				return false;
			else
				return (this.getId().equals(user.getId()));
		}
	}

	public int hashCode() {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId())
				return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}

}
